/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { HttpSrv } from 'lfun-bg-comp';

export interface Campus {
  school_id: any;
  campus_name: string;
  campus_no: string;
  contact_number: string;
  fax_number: string;
  campus_leader_name: string;
  campus_leader_position: string;
  long: string;
  lat: string;
  create_school_date: string;
  email: string;
  location_city: string;
  location_district: string;
  postal_code: string;
  detailed_address: string;
  related_license_upload: string;
}
export interface SearchCampus {
  school_id: any;
}

// 删除
export const deleteCampus = (campus_id: any) => HttpSrv().delete(`/school/v1/campus/?campus_id=${campus_id}`);
// 查询单个
export const getCampus = (campus_id: any) => HttpSrv().get(`/school/v1/campus/`, { params: { campus_id } });
// 新增
export const createCampus = (params: Campus) => HttpSrv().post('/school/v1/campus/', params);
// 修改
export const updateCampus = (campus_id: any, info: Campus) =>
  HttpSrv().put(`/school/v1/campus/?campus_id=${campus_id}`, info);
// 关闭
export const closeCampus = (campus_id: any, info: any) =>
  HttpSrv().patch(
    `/school/v1/campus/close?campus_id=${campus_id}&action_reason=${info.action_reason}&related_license_upload=${
      info.related_license_upload || ''
    }`
  );
// 分页查询
export const searchCampus = (params: SearchCampus, page: any, per_page: any) =>
  HttpSrv().get('/school/v1/campus/page', { params: { ...params, page, per_page } });
// 开办校区
export const openCampus = campus_id => HttpSrv().patch(`/school/v1/campus/open?campus_id=${campus_id}`);
